<template name="components">
	<view>
		<cu-custom bgColor="bg-gradual-pink" :isBack="false" :bgColorStyle="theme">
			<block slot="content">{{$t("消息通知")}}</block>
		</cu-custom>
		<view class="cu-bar bg-white search">
			<view class="search-form round">
				<text class="cuIcon-search"></text>
				<input type="text" placeholder="输入搜索的关键词" v-model="msgTitle" confirm-type="search"></input>
			</view>
			<view class="action">
				<button class="cu-btn shadow-blur round text-white" :style="{backgroundColor:theme}" @tap="search">搜索</button>
			</view>
		</view>
		<view @tap="toDetail(item.id)" class="cu-list menu indexes" v-for="(item,index) in dataList" style="margin-top:0rpx">
			<view class="cu-item" style="margin-top:1rpx">
				<view class="content">
					<text class="cuIcon-message text-red  margin-right-xs"></text>
					<text class="text-grey">{{item.msgTitle}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {mapState} from 'vuex'
	export default {
		computed:{
			...mapState(["theme"])
		},
		mounted() {
			this.getList()
		},
		data() {
			return {
				CustomBar: this.CustomBar,
				pageNo:1,
				pageSize:20,
				msgTitle: "",
				dataList:[]
			};
		},
		methods:{
			search(){
				this.getList()
			},
			getList(){
				this.$request({
					url: "a/msg/msgInner/listData",
					data:{
						msgTitle: this.msgTitle
					},
					success:(res)=>{
						let result = res.data.list
						console.log(result)
						this.dataList = result
					}
				})
			},
			// 进入详情
			toDetail(id){
				uni.navigateTo({
				    url: "/pages/component/detail?id=" + id
				});
			},
		}
	}
</script>

<style>
	.page {
		height: 100vh;
	}
	.indexes {
		position: relative;
	}
</style>
